package com.lovo.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 *
 * @author LiuChengQi
 * @date Created on 2020/11/19
 */
@Entity
@Table(name="course_1119")
@Data
@NoArgsConstructor
public class CourseDO implements Serializable {
    @Id
    @GenericGenerator(name="idGenerator", strategy="uuid")
    @GeneratedValue(generator="idGenerator")
    @Column(name = "cou_id")
    private String id;
    @Column(name = "cou_name")
    private String name;
    @ManyToMany(fetch = FetchType.EAGER,mappedBy = "courseDOList")
    @JsonIgnore
    private List<StudentDO> studentDOList = new ArrayList<>();
    public CourseDO(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "CourseDO{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
